import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; import javax.servlet.http.HttpSession; public class EditDwarfAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(); String dwarfIdString = request.getParameter("dwarf_id"); if(dwarfIdString != null && form != null){ int dwarf_id = Integer.parseInt(dwarfIdString); Dwarf d; try { d = DwarfMgr.Get(dwarf_id); }catch(java.sql.SQLException e){ throw new ServletException("SQLException" + e.getMessage()); } DwarfForm df = (DwarfForm)form; df.CopyFromDwarf(d); } return (mapping.findForward("success")); } }